preprocess data