Fixes #211 and adds one test for it.