Fixes #232, fixes #222