Fixed authorization bugs