Robustness improvements to scripts