Added check for quantity input.