Fixes to savelogin method in main controller.