Fix login issues

see #270 and #274