improve user agent parsing