Properly handling logout.