Mend logout functionality