corrected Willie Cheong's failed infinte loop