Fixed authorization and linear flow bugs