corrected a bug for logout()