fixed the bugs on userAgent detect