add some more error handling to auth