Some Bug Fixes

Fixes #6