Fix undef variables in template