diff --git a/api.php b/api.php
index <HASH>..<HASH> 100644
--- a/api.php
+++ b/api.php
@@ -1137,9 +1137,11 @@ class PHP_CRUD_API {
 	protected function applyBeforeHandler(&$action,&$database,&$table,&$ids,&$callback,&$inputs) {
 		if (is_callable($callback,true)) {
 			$max = count($ids)?:count($inputs);
-			$origaction = $action;
+			$initials = array('action'=>$action,'database'=>$database,'table'=>$table);
 			for ($i=0;$i<$max;$i++) {
-				$action = $origaction;
+				$action = $initials['action'];
+				$database = $initials['database'];
+				$table = $initials['table'];
 				if (!isset($ids[$i])) $ids[$i] = false;
 				if (!isset($inputs[$i])) $inputs[$i] = false;
 				$callback($action,$database,$table,$ids[$i],$inputs[$i]);
bugfix in line with #<I>