fixes to master script.