Login and other fixes