fixed error when executing query