Do not use query in wait loop