Astrometry near the galactic plane

I am trying to reduce a field taken with Subaru HSC which is near the galactic plane with hscPipe 6.7. When running processCcd, the astrometric solution found by the calibrate task is off, which then creates further problems for the photoCal task. My guess is this is happening due to the large number of stars in the field which make chance matches possible.

Surprisingly, instead of the standard configuration paramaters, if I pass config.processCcd.isr.doSaturation=False, the astrometry solution found is correct. In my debugging investigations, I found that the stars in the usableSourceCat passed to the _doMatch task are fairly similar in both set of configurations.

Question: is the _doMatch task in lsst/meas/astrom/matchOptimisticB/matchOptimisticBContinued.py applying some additional flags before performing the matching to the PanStarrs catalog? Is there a way to disable these flags given the large number of saturated stars in the galactic plane? I have tried the following to no avail.

config.processCcd.charImage.ref_match.sourceSelection.flags.bad=[]
config.processCcd.charImage.ref_match.matcher.sourceSelector['science'].flags.bad=[]
config.processCcd.calibrate.astrometry.matcher.sourceSelector['science'].flags.bad=[]
config.processCcd.calibrate.astrometry.sourceSelection.flags.bad=[]
config.processCcd.calibrate.photoCal.match.sourceSelection.flags.bad=[]
config.processCcd.charImage.ref_match.matcher.sourceSelector['astrometry'].badFlags=[]
config.processCcd.charImage.ref_match.matcher.sourceSelector['matcher'].badFlags=[]
config.processCcd.calibrate.astrometry.matcher.sourceSelector['astrometry'].badFlags=[]
config.processCcd.calibrate.astrometry.matcher.sourceSelector['matcherPessimistic'].badFlags=[]

A quick edit: Browsing through JIRA, I found that I need to use the matchPessimisticB task instead of matchOptimistic task for the dense stellar field.

I was able to retarget the task by adding the following in a config file and now it seems to work fine on the test ccd I was reducing:

from lsst.meas.astrom.matchPessimisticB import MatchPessimisticBTask
config.processCcd.calibrate.astrometry.matcher.retarget(MatchPessimisticBTask)