fix for User-Agent detection code