bugfix when deleting model