[IMP] improved code to set o2m fileds properly