EZP-22152: Fixed a logic error in template