Bugfixes for issue #98, #97