Found an issue with whitespace, caused by the url encode. Fixed by url decoding on comparison.