Fixes to folding.