improved login / logout behavior