revised merging of types to avoid merging types of different kinds, and to avoid merging frame types