Bug fixes to auth.