remove a mistake in algorithm