fixed logout issues with nil user