Fixed login issue with query