wow, that delete_if was horribly unsafe, should have used reject