Fixes for #151 and #107

Fixes for #151 and #107