Fixed the type of foldP.