handle logouts properly