Fix loop mistake in part A