fix bug where templates were not correctly precompiled