fix bug on destruction