fix and test for #47