fix conditions in template