Fixed authentication bugs.