Added __getstate__ and __setstate__ to classes with __slots__ so they can be pickled.