             # the amount displayed remaining subtracts off the amount you type in
             show_remaining = misc.round2(remaining + current - current_input)
 
-            val = @state["upgrade_#{name}"]
-            if misc.parse_number_input(val)?
+            val = misc.parse_number_input(@state["upgrade_#{name}"])
+            if val?
                 if not @is_upgrade_input_valid(Math.max(val, 0), limit)
                     reasons = []
                     if val > remaining + current then reasons.push('not enough upgrades')
-                    if val > limit then reasons.push('exceeding limit')
+                    if val > proj_remainder + current then reasons.push('exceeding limit')
                     reason = reasons.join(' and ')
                     bs_style = 'error'
                     label = <div style={UPGRADE_ERROR_STYLE}>Value too high: {reason}</div>

                </Row>
                <hr/>

                {@render_upgrade_row(n, @props.quota_params[n], remaining[n], current[n], limits[n], totals[n]) for n in PROJECT_UPGRADES.field_order}
                <UpgradeRestartWarning />
                {@props.children}
                <ButtonToolbar style={marginTop:'10px'}>

    render_addon: (misc, name, display_unit, limit) ->
        <div style={minWidth:'81px'}>{"#{misc.plural(2,display_unit)}"} {@render_max_button(name, limit)}</div>

    render_upgrade_row: (name, data, remaining=0, current=0, limit=0, total=0, proj_remainder=0) ->
        if not data?
            return

