small bug fix for loop function
Merge pull request #7 from kedebug/master

small bug fix for loop function