some cleanup for preprocess function and bugfix previous commit