fixed bug in deconstructor