Use reject instead of the destructive keep_if

Fixes bug where non-string allocations were ignored (and fixes the tests)