Fixed small bug in TestTextPatternRewrite