Output even match positions in debug mode
Fix tag matching with edge cases