Various fixes to script and demos