looping error fix