fix looping issue