Fixes to build model script