Fixed bug in authentication