fixed preprocessing bug for training and predicting mode