Misc script fixes