fixed broken tests and broken authorization middleware