Fix query loading issue