correct gettdoc functions for polymorphic documents (closes #4279)