Paul's work. logout and other fix