Bug fix in authentication