Bug fix with recursive call