Enable automatic pickling

Only the associated creation parameter will be pickled - not the
referenced object.
Add test for pickling