Make login more stable

see #270