Fixing a bug encountered when logging out