fixed logout and auto redirect