Fixed looping error.