fixing quantity max problem