Previous backtrace fix wasn't quite right

Setting of previ and prevj is contingent on current pair having a forced gap (keepGapping is 1 or 2). Thus this code must be separate from and go before the setting of keepGapping for the next pair.