Fixed infinite loop problem.