Updated to work around a couple of runscript bugs.