fixing looping