found and fixed bug in constructor and destructor