Escape the array elements separately and join them in compile_binds()
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index 0943569..fc1d956 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -922,7 +922,12 @@
 		do
 		{
 			$c--;
-			$sql = substr_replace($sql, $this->escape($binds[$c]), $matches[0][$c][1], $ml);
+			$escaped_value = $this->escape($binds[$c]);
+			if (is_array($escaped_value))
+			{
+				$escaped_value = '('.implode(',', $escaped_value).')';
+			}
+			$sql = substr_replace($sql, $escaped_value, $matches[0][$c][1], $ml);
 		}
 		while ($c !== 0);
 
@@ -995,7 +1000,7 @@
 		if (is_array($str))
 		{
 			$str = array_map(array(&$this, 'escape'), $str);
-			return '('.implode(',', $str).')';
+			return $str;
 		}
 		elseif (is_string($str) OR (is_object($str) && method_exists($str, '__toString')))
 		{