Correctly works with branches (I think).

Fixes #2