Fix possible NPE.
Clean up code.
Merge pull request #1558 from jburel/open-browser

Open browser