improve uri handling