fix addStats bugs due to the adoption of data.table