Bug fixes

Fixes issue #55