fix bug when authenticating/creating users