fixing redirect and authorization issues