Fix a crasher where when we're attempting to replace a type