Fixed redundant compilation of templates (really fixes #9)

This follows the conversation in #9