Fix #13721. Filter before .remove() loop so positionals work. Close gh-1221.

(Cherry picked from 1b610266502490eab42a0b9ddfac2f93da0b0fe1)