Fix reduce regression 13304.

Also cover test case 10709.