removed segfault from destructor