fixed double destructor call and tests now pass with valgrind showing no leaks