Improve url handling