fixed folding of functions and unions