fix obscure user-agent parsing bug