fixed crash in deinit