Fixes #211 and adds one test for it.

fixes #211