Fixes #29 and #23