Fix for missing virtual destructor for abstract class which was causing undefined behaviour.