Minor cleanup in model.populate
Fix #2214
Test coverage for #2214