Fixed missing unescaping.
Made error a little bit more explicit.
Fixed type URI.