Fixed the signing in and the permission checking.