Use find_if instead of remove_if.

The former leaves the value undefined. Not good.