Add tests for #9914
Fix #9914