#29 fix and #31 fix

Fix for #29 and #31