fixed the order in which flattened inner classes are added after the outer