Fix #7 and #9

Fixes #7 and #9