Changes in construct_bn to deal with data.table