fix bugs in preprocess; add more test cases for preprocess