Fix model-integrity bugs