fixed bugs with authorization