Fixed bug in user authentication