applied JacobL's patch on ATAGs