 		setExpirationDateText(with: product?.expirationDate ?? Date())
 		categoryTextField.text = product?.category ?? ProductCategory.active.rawValue
 
-		//FIXME: these show nil instead of 0
-		numberUsedTextField.text = String(describing: product?.numberUsed.value)
-		numberInStashTextField.text = String(describing: product?.numberInStash.value)
+		if let used = product?.numberUsed.value {
+			numberUsedTextField.text = String(describing: used)
+		}
+
+		if let inStash = product?.numberInStash.value {
+			numberInStashTextField.text = String(describing: inStash)
+		}
 
 		willRepurchaseSwitch.isOn = product?.willRepurchase.value ?? false
 

// MARK: Text field delegate
extension ProductViewController: UITextFieldDelegate {
	func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
		if textField == categoryTextField {
			return false
		}
		
		guard textField == priceTextField else {
			return true
		}

					} else {
						date = nil
					}
					product.expirationDate = date

					product.category = categoryTextField.text ?? ProductCategory.active.rawValue

					if let numberInStash = numberInStashTextField.text {
						product.numberInStash.value = Int(numberInStash)
					}

					if let numberUsed = numberUsedTextField.text {
						product.numberUsed.value = Int(numberUsed)
					}

					product.willRepurchase.value = willRepurchaseSwitch.isOn

					product.ingredients = ingredientsTextView.text

					//TODO: find out if this writes to realm twice, once here and once when we add it to the list
					realm?.add(product, update: true)
