         ref = "upgrade_#{quota}"
         if input_type == 'number'
             val = @state.upgrades[quota] ? misc.round1(yours / num_projects)
-            if not @is_upgrade_input_valid(val*num_projects, limit)
+            if not @is_upgrade_input_valid(val, limit)
                 bs_style = 'error'
                 @_upgrade_is_invalid = true
             <span>

            return false
        num_projects = @_num_projects
        for quota, val of @state.upgrades
            if val*num_projects != @_your_upgrades[quota]
                changed = true
        return changed


            </span>
        else if input_type == 'checkbox'
            val = @state.upgrades[quota] ? (if yours > 0 then 1 else 0)
            is_valid = @is_upgrade_input_valid(val, limit)
            if not is_valid
                @_upgrade_is_invalid = true
                label = "Can't enable -- not enough upgrades"
            else
                label = if val == 0 then 'Enable' else 'Enabled'
            <form>
                <Input
                    ref      = {ref}
                    type     = 'checkbox'
                    checked  = {val > 0}
                    label    = {label}
                    onChange = {=>u=@state.upgrades; u[quota] = (if @refs[ref].getChecked() then 1 else 0); @setState(upgrades:u)}
                    />
            </form>
