Browser bug fix

Fixes #10 as well as some other minor changes.

This doesn't fix the fact that the tests didn't pick up this bug in the first place though.