Some fixes in URI handling code

Signed-off-by: Harshavardhana <fharshav@redhat.com>