Some minor fixes to scripting
Add script for checking consistency of output