Fix query flag queue not advancing at the right time causing every query to fail.