Fixed redundant compilation of templates (really fixes #9)