so i have been debugging for the past 2 hours and i just cant find the problem

the first two images are out of order, its the second one then the first one