fix #213, add test for it