Bugfix in recursion