Fix issue with stack overflow in test