handle selfmap in conversion to fold