add check browser api and fix var scopes