fixes #3

Combine the fixes from issue #3.
Awesome job! Go ahead and merge this back into master.