improve url handling