Fix login logout process