add support for hetmet_flatten casting variable