unit tests for pickling/unpickling