corrected somes bugs related to data.table usage instead of data.frame