fixing logout function