Add tests for pickling