Fix improper use of delete_if