make login test pass (plus many minor tweaks)