Fix #7516, could use some extra testing...