Fix sign in and register function