Bugfixes for #2, #3
Fixes issue #2
Fixes issue #3