Fixed errors introduced with last update

- Actually fixed the on-demand structs issue. Template appears to
  run much faster (previous update introduced bugs)
 - Properly configured the optimize=true|false flags for structs