Corrected mistake in scanning string