remove division by zero in template