foldp and fixes