Fixed user authentication query