fix definition of foldr and foldr1