Fix bugs found in testing new filtering code.