small modifications on Query.php