Fixing the random index pull logic