stitch detector, copied from nop-detector