various bugs, detect user agent