Fix 'bad URI' exceptions