Backport pr #33 into 0.9.x

Fixes #35.