Bug fix in calls to __setstate__