looping error fixed