foldUp corrected for non-recursive contexts