Fix a TyVar bug in the flattener