Bug Fixes

Fixes issue #2 and #5