A few bug fixes to get the scripts working