Fix for compiler tags reversed using same characters breaking. Fixes #1808

As explained in the issue. Don't know if you would rather not use the `$difference` variable since it is redundant however more readable. Or even comment to explain to people why the check is needed. But Jason tested that and he said it works, I'll write tests in a minute (doing lazy github editing).