fixed for loop end value in app.py