Fix null ref error if model type is object