Fixed to work with full URI, a bit better error reporting