Fixing the loop bug with the routes