fix bugs of authentication