bugfixes and error handling in authorization