Fixes logout function