changing `n` to `x` for `save_each` function