fixed authentication bugs