fix NPE when UserAgent is not detected