Fix #2501 & another -related bug
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index 425657e..53decf0 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -1375,7 +1375,9 @@
 			$fields[$this->protect_identifiers($key)] = $this->escape($val);
 		}
 
-		return $this->_update($this->protect_identifiers($table, TRUE, NULL, FALSE), $fields);
+		$sql = $this->_update($this->protect_identifiers($table, TRUE, NULL, FALSE), $fields);
+		$this->_reset_write();
+		return $sql;
 	}
 
 	// --------------------------------------------------------------------