Replace empty array with undef

because if() in template evaluates [] as true