Broke out of loop too early