fixed unecessary looping in the button example