Fixed model to prevent database corruption.