improved url detection