BART popping if you press bank one away from max pump

Hello,

I’ve built out a BART experiment from the BART template and have noticed that if you press return after, for example 9 pumps and the max pump for that trial is 10, the balloon will burst. Has anyone encountered this before or know how to solve it?

#calculate cash 'earned'
if pump.thisN+1 == maxPumps:
    popped = True
else:
    popped = False

# if balloon popped reset the earnings
if popped:
  thisBalloonEarnings=0.0
  lastBalloonEarnings=0.0
else:
    lastBalloonEarnings=thisBalloonEarnings

if 'return' in bankButton.keys:
    pump.finished = True