Minor bugfixes and workaround for #12
Fixes #12