Fix some warnings

This is a bit obscure. I wonder if we could make it more clear that `i` is used... (unrelated to this PR)