Fix and test for #2607