Type families: fixes in flattening & finalisation