fixed Uri::segment_replace() for complex uri's. closes #1392