fix in quantity detection