Fix bug around duplicate Id generation for generic types