Fixed bug when setting a model in a documentmodel.