More tern

Add browser.json to tern by default and a couple of bug fixes.