Fixed minor bug.
Fixed bug in code detecting whether authorization is needed.