Improved uri matching