fixes #3

Combine the fixes from issue #3.