Fixing errors with authentication