Fix recursive call to flatten array and add to results