Fix some issues; added a script to copy the template before re-building to avoid some flaky cases where the modified template is not picked up into the jar