fix for stack overflow in each