fixed the race condition bug with user query