Fixed duplicated i var.