improved url handling