Interesting bug! It seems like the issue might be related to how the nested define is being evaluated within the recursion. Have you tried moving the heardle define statements outside the cond or using let instead? It could help clarify the scope and prevent unexpected behavior.