fix some issues related to copy paste fail during templating