Add fix and test for #2607