silly mistake in while loop