Fixed issue with model.toObject().