fix bug when looping