fixed bug in ready to execute query