final fixes to preprocessing script