fix logout function