Fixes #163 and #168