Solve problem with term flattening when mixing int/real vars