Fix infinite loop bug

Loop condition was never satisfied.