Lamblin fix pickle cache leak2

rebase of gh-1513 and a good fix to the pickling of Composite.