Fix a bug with instance hierarchy