foldRSeqNode now processes non-leaf nodes as well