fix bug in preprocessing