Fixes #18, fixes #22