Fix problem with logout function