Trying to fix exception when logging out