Fixes #20 and #28