Fix loop variables in reflection minor calculation