fixed logic errors in login