fix addToDataField function