Fix login, logout issues