Fixed bugs relating to unloading login form