fix bug in data preprocessing