fix #2619
it was hard to write a test for this!