fixed logout behaviour