fixed some authentication bugs