fix bug which caused authentication process to throw an exception