minor cleanup
Add unit test for #656
Fix #656 for 2.4 as well
Merge branch '2.4'