fix with __getstate__ for correct pickling