Fix for #131 and #129