added try/catch in browser detect