fixing detection of user agents properly