Fix user query on login check