Fixes to auth system.