fixed dataset prep bug (only produced bug when regenerating only part of the dataset. But should be ok if the dataset is generated brand new each time....)