Fixed some variable scope issues that were preventing autofit from running via the GUI.  It's kind of ugly, but it works...