add static linking and fix a few filtering bugs