Improved script robustness.