Fix bugs in preprocessor