Add try/catch to avoid crashes during execution of the script.