compile template only once