Fix build script for templates