easier fix: if(!amount && amount !== 0) { amount = data(this.id)[resourceType]; }