More fixes from the conversion to being a script.