Fix template generation #18

will close #18