Work around dynamic_cast failure on RHEL5.