Bugfix (#100)

Fixes #100. See the issue for more details on the bug and how it was fixed.