fixes iterating over enums
some steps to improve the type mismatches with the new
generic instantiation logic