Some fixes, add logout
Fix login behaviour