fix some bugs involving empty fields and quantities being passed as strings