Adding fixes and tests for URL parsing