It does not happen if the line in the inner loop is commented out