Updated __setstate__ as per Scott Purdy's recommendation.