Fixes #900 (includes unit test)