changed grep in remove_fail_paths function