Fixes #12 and #22