fixed bugs in resource url normalization & added doctests