Index: src/podofo/base/PdfCanvas.cpp
===================================================================
--- src/podofo/base/PdfCanvas.cpp	(revision 1999)
+++ src/podofo/base/PdfCanvas.cpp	(working copy)
@@ -72,7 +72,7 @@
             
 			if ( 
 				! pResource->GetDictionary().HasKey( "ColorSpace" )	||
-				! pResource->GetDictionary().GetKey( "ColorSpace" )->GetDictionary().HasKey( csPrefix + csName )
+                ! pResource->MustGetIndirectKey( "ColorSpace" )->GetDictionary().HasKey( csPrefix + csName )
                 )
 			{
 				// Build color-spaces for separation
@@ -87,7 +87,7 @@
 		{
 			if ( 
 				! pResource->GetDictionary().HasKey( "ColorSpace" )	||
-				! pResource->GetDictionary().GetKey( "ColorSpace" )->GetDictionary().HasKey( "ColorSpaceLab" )
+                ! pResource->MustGetIndirectKey( "ColorSpace" )->GetDictionary().HasKey( "ColorSpaceLab" )
 			   )
 			{
 				// Build color-spaces for CIE-lab
Index: src/podofo/base/PdfFilter.cpp
===================================================================
--- src/podofo/base/PdfFilter.cpp	(revision 1999)
+++ src/podofo/base/PdfFilter.cpp	(working copy)
@@ -412,7 +412,7 @@
     const PdfObject* pObj    = NULL;
 
     if( pObject->IsDictionary() && pObject->GetDictionary().HasKey( "Filter" ) )
-        pObj = pObject->GetDictionary().GetKey( "Filter" );
+        pObj = pObject->GetIndirectKey( "Filter" );
     else if( pObject->IsArray() )
         pObj = pObject;
     else if( pObject->IsName() ) 
Index: src/podofo/base/PdfObject.cpp
===================================================================
--- src/podofo/base/PdfObject.cpp	(revision 1999)
+++ src/podofo/base/PdfObject.cpp	(working copy)
@@ -243,6 +243,56 @@
     return const_cast<PdfObject*>(pObj);
 }
 
+pdf_int64 PdfObject::GetIndirectKeyAsLong( const PdfName & key, pdf_int64 lDefault ) const
+{
+    const PdfObject* pObject = GetIndirectKey( key );
+    
+    if( pObject && pObject->GetDataType() == ePdfDataType_Number ) 
+    {
+        return pObject->GetNumber();
+    }
+
+    return lDefault;
+}
+
+double PdfObject::GetIndirectKeyAsReal( const PdfName & key, double dDefault ) const
+{
+    const PdfObject* pObject = GetIndirectKey( key );
+    
+    if( pObject && (
+        pObject->GetDataType() == ePdfDataType_Real ||
+        pObject->GetDataType() == ePdfDataType_Number))
+    {
+        return pObject->GetReal();
+    }
+
+    return dDefault;
+}
+
+bool PdfObject::GetIndirectKeyAsBool( const PdfName & key, bool bDefault ) const
+{
+    const PdfObject* pObject = GetIndirectKey( key );
+
+    if( pObject && pObject->GetDataType() == ePdfDataType_Bool ) 
+    {
+        return pObject->GetBool();
+    }
+
+    return bDefault;
+}
+
+PdfName PdfObject::GetIndirectKeyAsName( const PdfName & key ) const
+{
+    const PdfObject* pObject = GetIndirectKey( key );
+
+    if( pObject && pObject->GetDataType() == ePdfDataType_Name ) 
+    {
+        return pObject->GetName();
+    }
+    
+    return PdfName(""); // return an empty name
+}
+
 pdf_long PdfObject::GetObjectLength( EPdfWriteMode eWriteMode )
 {
     PdfOutputDevice device;
Index: src/podofo/base/PdfObject.h
===================================================================
--- src/podofo/base/PdfObject.h	(revision 1999)
+++ src/podofo/base/PdfObject.h	(working copy)
@@ -177,6 +177,14 @@
      */
     inline PdfObject* MustGetIndirectKey( const PdfName & key ) const;
 
+    pdf_int64 GetIndirectKeyAsLong( const PdfName & key, pdf_int64 lDefault = 0 ) const;
+
+    double GetIndirectKeyAsReal( const PdfName & key, double dDefault = 0.0 ) const;
+
+    bool GetIndirectKeyAsBool( const PdfName & key, bool bDefault = false ) const;
+
+    PdfName GetIndirectKeyAsName( const PdfName & key ) const;
+
     /** Write the complete object to a file.
      *  \param pDevice write the object to this device
      *  \param pEncrypt an encryption object which is used to encrypt this object
Index: src/podofo/base/PdfObjectStreamParserObject.cpp
===================================================================
--- src/podofo/base/PdfObjectStreamParserObject.cpp	(revision 1999)
+++ src/podofo/base/PdfObjectStreamParserObject.cpp	(working copy)
@@ -62,8 +62,8 @@
 
 void PdfObjectStreamParserObject::Parse(ObjectIdList const & list)
 {
-    pdf_int64 lNum   = m_pParser->GetDictionary().GetKeyAsLong( "N", 0 );
-    pdf_int64 lFirst = m_pParser->GetDictionary().GetKeyAsLong( "First", 0 );
+    pdf_int64 lNum   = m_pParser->GetIndirectKeyAsLong( "N", 0 );
+    pdf_int64 lFirst = m_pParser->GetIndirectKeyAsLong( "First", 0 );
     
     char* pBuffer;
     pdf_long lBufferLen;
Index: src/podofo/base/PdfParser.cpp
===================================================================
--- src/podofo/base/PdfParser.cpp	(revision 1999)
+++ src/podofo/base/PdfParser.cpp	(working copy)
@@ -1437,7 +1437,7 @@
             && pCatalog->IsDictionary() 
             && pCatalog->GetDictionary().HasKey( PdfName("Version" ) ) ) 
         {
-            PdfObject* pVersion = pCatalog->GetDictionary().GetKey( PdfName( "Version" ) );
+            PdfObject* pVersion = pCatalog->MustGetIndirectKey( PdfName( "Version" ) );
             for(int i=0;i<=MAX_PDF_VERSION_STRING_INDEX;i++)
             {
                 if( IsStrictParsing() && !pVersion->IsName())
Index: src/podofo/base/PdfParserObject.cpp
===================================================================
--- src/podofo/base/PdfParserObject.cpp	(revision 1999)
+++ src/podofo/base/PdfParserObject.cpp	(working copy)
@@ -331,11 +331,16 @@
 	if( m_pEncrypt && !m_pEncrypt->IsMetadataEncrypted() ) {
 		// If metadata is not encrypted the Filter is set to "Crypt"
 		PdfObject* pFilterObj = this->GetDictionary_NoDL().GetKey( PdfName::KeyFilter );
+        if( pFilterObj && pFilterObj->IsReference() )
+            pFilterObj = m_pOwner->GetObject( pFilterObj->GetReference() );
 		if( pFilterObj && pFilterObj->IsArray() ) {
 			PdfArray filters = pFilterObj->GetArray();
 			for(PdfArray::iterator it = filters.begin(); it != filters.end(); it++) {
-				if( (*it).IsName() )
-					if( (*it).GetName() == "Crypt" )
+                PdfObject *filter = &*it;
+                if( filter->IsReference() )
+                    filter = m_pOwner->GetObject( filter->GetReference() );
+                if( filter && filter->IsName() )
+                    if( filter->GetName() == "Crypt" )
 						m_pEncrypt = 0;
 			}
 		}
Index: src/podofo/doc/PdfAcroForm.cpp
===================================================================
--- src/podofo/doc/PdfAcroForm.cpp	(revision 1999)
+++ src/podofo/doc/PdfAcroForm.cpp	(working copy)
@@ -85,15 +85,11 @@
         // Create DR key
         if( !this->GetObject()->GetDictionary().HasKey( PdfName("DR") ) )
             this->GetObject()->GetDictionary().AddKey( PdfName("DR"), PdfDictionary() );
-        pResource = this->GetObject()->GetDictionary().GetKey( PdfName("DR") );
-        if( pResource->IsReference() )
-            pResource = m_pDocument->GetObjects()->GetObject( pResource->GetReference() );
+        pResource = this->GetObject()->MustGetIndirectKey( PdfName("DR") );
         
         if( !pResource->GetDictionary().HasKey( PdfName("Font") ) )
             pResource->GetDictionary().AddKey( PdfName("Font"), PdfDictionary() );
-        pFontDict = pResource->GetDictionary().GetKey( PdfName("Font") );
-        if( pFontDict->IsReference() )
-            pFontDict = m_pDocument->GetObjects()->GetObject( pFontDict->GetReference() );
+        pFontDict = pResource->MustGetIndirectKey( PdfName("Font") );
 
         pFontDict->GetDictionary().AddKey( pFont->GetIdentifier(), pFont->GetObject()->Reference() );
         
@@ -127,7 +123,7 @@
 
 bool PdfAcroForm::GetNeedAppearances() const
 {
-    return this->GetObject()->GetDictionary().GetKeyAsBool( PdfName("NeedAppearances"), false );
+    return this->GetObject()->GetIndirectKeyAsBool( PdfName("NeedAppearances"), false );
 }
 
 };
Index: src/podofo/doc/PdfAction.cpp
===================================================================
--- src/podofo/doc/PdfAction.cpp	(revision 1999)
+++ src/podofo/doc/PdfAction.cpp	(working copy)
@@ -91,13 +91,13 @@
     // The typename /Action is optional for PdfActions
     : PdfElement( NULL, pObject )
 {
-    m_eType = static_cast<EPdfAction>(TypeNameToIndex( this->GetObject()->GetDictionary().GetKeyAsName( "S" ).GetName().c_str(), s_names, s_lNumActions, ePdfAction_Unknown ));
+    m_eType = static_cast<EPdfAction>(TypeNameToIndex( this->GetObject()->GetIndirectKeyAsName( "S" ).GetName().c_str(), s_names, s_lNumActions, ePdfAction_Unknown ));
 }
 
 PdfAction::PdfAction( const PdfAction & rhs )
     : PdfElement( "Action", rhs.GetNonConstObject() )
 {
-    m_eType = static_cast<EPdfAction>(TypeNameToIndex( this->GetObject()->GetDictionary().GetKeyAsName( "S" ).GetName().c_str(), s_names, s_lNumActions, ePdfAction_Unknown ));
+    m_eType = static_cast<EPdfAction>(TypeNameToIndex( this->GetObject()->GetIndirectKeyAsName( "S" ).GetName().c_str(), s_names, s_lNumActions, ePdfAction_Unknown ));
 }
 
 void PdfAction::SetURI( const PdfString & sUri )
@@ -123,7 +123,7 @@
 
 PdfString PdfAction::GetScript() const
 {
-    return this->GetObject()->GetDictionary().GetKey( "JS" )->GetString();
+    return this->GetObject()->MustGetIndirectKey( "JS" )->GetString();
 
 }
 
Index: src/podofo/doc/PdfAnnotation.cpp
===================================================================
--- src/podofo/doc/PdfAnnotation.cpp	(revision 1999)
+++ src/podofo/doc/PdfAnnotation.cpp	(working copy)
@@ -104,7 +104,7 @@
 PdfAnnotation::PdfAnnotation( PdfObject* pObject, PdfPage* pPage )
     : PdfElement( "Annot", pObject ), m_eAnnotation( ePdfAnnotation_Unknown ), m_pAction( NULL ), m_pFileSpec( NULL ), m_pPage( pPage )
 {
-    m_eAnnotation = static_cast<EPdfAnnotation>(TypeNameToIndex( this->GetObject()->GetDictionary().GetKeyAsName( PdfName::KeySubtype ).GetName().c_str(), s_names, s_lNumActions, ePdfAnnotation_Unknown ));
+    m_eAnnotation = static_cast<EPdfAnnotation>(TypeNameToIndex( this->GetObject()->GetIndirectKeyAsName( PdfName::KeySubtype ).GetName().c_str(), s_names, s_lNumActions, ePdfAnnotation_Unknown ));
 }
 
 PdfAnnotation::~PdfAnnotation()
@@ -116,7 +116,7 @@
 PdfRect PdfAnnotation::GetRect() const
 {
    if( this->GetObject()->GetDictionary().HasKey( PdfName::KeyRect ) )
-        return PdfRect( this->GetObject()->GetDictionary().GetKey( PdfName::KeyRect )->GetArray() );
+        return PdfRect( this->GetObject()->MustGetIndirectKey( PdfName::KeyRect )->GetArray() );
 
    return PdfRect();
 }
@@ -246,7 +246,7 @@
 pdf_uint32 PdfAnnotation::GetFlags() const
 {
     if( this->GetObject()->GetDictionary().HasKey( "F" ) )
-        return static_cast<pdf_uint32>(this->GetObject()->GetDictionary().GetKey( "F" )->GetNumber());
+        return static_cast<pdf_uint32>(this->GetObject()->MustGetIndirectKey( "F" )->GetNumber());
 
     return static_cast<pdf_uint32>(0);
 }
@@ -278,7 +278,7 @@
 PdfString PdfAnnotation::GetTitle() const
 {
     if( this->GetObject()->GetDictionary().HasKey( "T" ) )
-        return this->GetObject()->GetDictionary().GetKey( "T" )->GetString();
+        return this->GetObject()->MustGetIndirectKey( "T" )->GetString();
 
     return PdfString();
 }
@@ -291,7 +291,7 @@
 PdfString PdfAnnotation::GetContents() const
 {
     if( this->GetObject()->GetDictionary().HasKey( "Contents" ) )
-        return this->GetObject()->GetDictionary().GetKey( "Contents" )->GetString();
+        return this->GetObject()->MustGetIndirectKey( "Contents" )->GetString();
 
     return PdfString();
 }
@@ -303,7 +303,7 @@
 
 PdfDestination PdfAnnotation::GetDestination( PdfDocument* pDoc ) const
 {
-    return PdfDestination( this->GetNonConstObject()->GetDictionary().GetKey( "Dest" ), pDoc );
+    return PdfDestination( this->GetNonConstObject()->MustGetIndirectKey( "Dest" ), pDoc );
 }
 
 bool PdfAnnotation::HasDestination() const
@@ -341,7 +341,7 @@
 bool PdfAnnotation::GetOpen() const
 {
     if( this->GetObject()->GetDictionary().HasKey( "Open" ) )
-        return this->GetObject()->GetDictionary().GetKey( "Open" )->GetBool();
+        return this->GetObject()->MustGetIndirectKey( "Open" )->GetBool();
 
     return false;
 }
@@ -371,7 +371,7 @@
 PdfArray PdfAnnotation::GetQuadPoints() const
 {
     if( this->GetObject()->GetDictionary().HasKey( "QuadPoints" ) )
-        return PdfArray( this->GetObject()->GetDictionary().GetKey( "QuadPoints" )->GetArray() );
+        return PdfArray( this->GetObject()->MustGetIndirectKey( "QuadPoints" )->GetArray() );
 
     return PdfArray();
 }
@@ -390,7 +390,7 @@
 PdfArray PdfAnnotation::GetColor() const
 {
     if( this->GetObject()->GetDictionary().HasKey( "C" ) )
-        return PdfArray( this->GetObject()->GetDictionary().GetKey( "C" )->GetArray() );
+        return PdfArray( this->GetObject()->MustGetIndirectKey( "C" )->GetArray() );
     return PdfArray();
 }
 
Index: src/podofo/doc/PdfDestination.cpp
===================================================================
--- src/podofo/doc/PdfDestination.cpp	(revision 1999)
+++ src/podofo/doc/PdfDestination.cpp	(working copy)
@@ -218,7 +218,7 @@
         if( pValue->IsArray() ) 
             m_array = pValue->GetArray();
         else if( pValue->IsDictionary() )
-            m_array = pValue->GetDictionary().GetKey( "D" )->GetArray();
+            m_array = pValue->MustGetIndirectKey( "D" )->GetArray();
         m_pObject = pValue;
     }
 }
Index: src/podofo/doc/PdfDifferenceEncoding.cpp
===================================================================
--- src/podofo/doc/PdfDifferenceEncoding.cpp	(revision 1999)
+++ src/podofo/doc/PdfDifferenceEncoding.cpp	(working copy)
@@ -2388,7 +2388,7 @@
 
     if( this->GetObject()->GetDictionary().HasKey( PdfName("BaseEncoding") ) )
     {
-        const PdfName & rBase = this->GetObject()->GetDictionary().GetKey( PdfName("BaseEncoding") )->GetName();
+        const PdfName & rBase = this->GetObject()->MustGetIndirectKey( PdfName("BaseEncoding") )->GetName();
         
         if( rBase == PdfName("WinAnsiEncoding") )
             m_baseEncoding = eBaseEncoding_WinAnsi;
Index: src/podofo/doc/PdfDocument.cpp
===================================================================
--- src/podofo/doc/PdfDocument.cpp	(revision 1999)
+++ src/podofo/doc/PdfDocument.cpp	(working copy)
@@ -504,11 +504,7 @@
     if( pObj->IsDictionary() && pObj->GetDictionary().HasKey( "Contents" ) )
     {
         // get direct pointer to contents
-        PdfObject* pContents;
-        if( pObj->GetDictionary().GetKey( "Contents" )->IsReference() )
-            pContents = m_vecObjects.GetObject( pObj->GetDictionary().GetKey( "Contents" )->GetReference() );
-        else
-            pContents = pObj->GetDictionary().GetKey( "Contents" );
+        PdfObject* pContents = pObj->MustGetIndirectKey( "Contents" );
 
         if( pContents->IsArray() )
         {
Index: src/podofo/doc/PdfElement.cpp
===================================================================
--- src/podofo/doc/PdfElement.cpp	(revision 1999)
+++ src/podofo/doc/PdfElement.cpp	(working copy)
@@ -71,10 +71,10 @@
 
     if( pszType
         && m_pObject->GetDictionary().HasKey( PdfName::KeyType )
-        && m_pObject->GetDictionary().GetKeyAsName( PdfName::KeyType ) != pszType ) 
+        && m_pObject->GetIndirectKeyAsName( PdfName::KeyType ) != pszType ) 
     {
         PdfError::LogMessage( eLogSeverity_Debug, "Expected key %s but got key %s.", 
-                              pszType, m_pObject->GetDictionary().GetKeyAsName( PdfName::KeyType ).GetName().c_str() );
+                              pszType, m_pObject->GetIndirectKeyAsName( PdfName::KeyType ).GetName().c_str() );
 
         PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
     }
Index: src/podofo/doc/PdfField.cpp
===================================================================
--- src/podofo/doc/PdfField.cpp	(revision 1999)
+++ src/podofo/doc/PdfField.cpp	(working copy)
@@ -166,7 +166,7 @@
     : m_pObject( pObject ), m_pWidget( pWidget ), m_eField( ePdfField_Unknown )
 {
     // ISO 32000:2008, Section 12.7.3.1, Table 220, Page #432.
-    const PdfObject *pFT = m_pObject->GetDictionary().GetKey(PdfName("FT") );
+    const PdfObject *pFT = m_pObject->GetIndirectKey(PdfName("FT") );
 
     if (!pFT && m_pObject->GetDictionary().HasKey( PdfName ("Parent") ) )
     {
@@ -176,7 +176,7 @@
             PODOFO_RAISE_ERROR (ePdfError_InvalidDataType);
         }
 
-        pFT = pTemp->GetDictionary().GetKey( PdfName ("FT") );
+        pFT = pTemp->GetIndirectKey( PdfName ("FT") );
     }
 
     if (!pFT)
@@ -218,7 +218,7 @@
         const_cast<PdfField*>(this)->m_pObject->GetDictionary().AddKey( PdfName("MK"), dictionary );
     }
 
-    pMK = m_pObject->GetDictionary().GetKey( PdfName("MK") );
+    pMK = m_pObject->GetIndirectKey( PdfName("MK") );
 
     return pMK;
 }
@@ -228,7 +228,7 @@
     pdf_int64 lCur = 0;
 
     if( m_pObject->GetDictionary().HasKey( PdfName("Ff") ) )
-        lCur = m_pObject->GetDictionary().GetKey( PdfName("Ff") )->GetNumber();
+        lCur = m_pObject->MustGetIndirectKey( PdfName("Ff") )->GetNumber();
     
     if( bSet )
         lCur |= lValue;
@@ -247,7 +247,7 @@
 
     if( m_pObject->GetDictionary().HasKey( PdfName("Ff") ) )
     {
-        lCur = m_pObject->GetDictionary().GetKey( PdfName("Ff") )->GetNumber();
+        lCur = m_pObject->MustGetIndirectKey( PdfName("Ff") )->GetNumber();
 
         return (lCur & lValue) == lValue; 
     }
@@ -288,7 +288,7 @@
 
     if( m_pObject->GetDictionary().HasKey( PdfName("H") ) )
     {
-        PdfName value = m_pObject->GetDictionary().GetKey( PdfName("H") )->GetName();
+        PdfName value = m_pObject->MustGetIndirectKey( PdfName("H") )->GetName();
         if( value == PdfName("N") )
             return ePdfHighlightingMode_None;
         else if( value == PdfName("I") )
@@ -390,7 +390,7 @@
 PdfString PdfField::GetFieldName() const
 {
     if( m_pObject->GetDictionary().HasKey( PdfName("T" ) ) )
-        return m_pObject->GetDictionary().GetKey( PdfName("T" ) )->GetString();
+        return m_pObject->MustGetIndirectKey( PdfName("T" ) )->GetString();
 
     return PdfString::StringNull;
 }
@@ -403,7 +403,7 @@
 PdfString PdfField::GetAlternateName() const
 {
     if( m_pObject->GetDictionary().HasKey( PdfName("TU" ) ) )
-        return m_pObject->GetDictionary().GetKey( PdfName("TU" ) )->GetString();
+        return m_pObject->MustGetIndirectKey( PdfName("TU" ) )->GetString();
 
     return PdfString::StringNull;
 }
@@ -416,7 +416,7 @@
 PdfString PdfField::GetMappingName() const
 {
     if( m_pObject->GetDictionary().HasKey( PdfName("TM" ) ) )
-        return m_pObject->GetDictionary().GetKey( PdfName("TM" ) )->GetString();
+        return m_pObject->MustGetIndirectKey( PdfName("TM" ) )->GetString();
 
     return PdfString::StringNull;
 }
@@ -426,7 +426,7 @@
     if( !m_pObject->GetDictionary().HasKey( PdfName("AA") ) ) 
         m_pObject->GetDictionary().AddKey( PdfName("AA"), PdfDictionary() );
 
-    PdfObject* pAA = m_pObject->GetDictionary().GetKey( PdfName("AA") );
+    PdfObject* pAA = m_pObject->MustGetIndirectKey( PdfName("AA") );
     pAA->GetDictionary().AddKey( rsName, rAction.GetObject()->Reference() );
 }
 
@@ -468,7 +468,7 @@
     PdfObject* pMK = this->GetAppearanceCharacteristics( false );
     
     if( pMK && pMK->GetDictionary().HasKey( PdfName("CA") ) )
-        return pMK->GetDictionary().GetKey( PdfName("CA") )->GetString();
+        return pMK->MustGetIndirectKey( PdfName("CA") )->GetString();
 
     return PdfString::StringNull;
 }
@@ -562,7 +562,7 @@
     PdfObject* pMK = this->GetAppearanceCharacteristics( false );
     
     if( pMK && pMK->GetDictionary().HasKey( PdfName("RC") ) )
-        return pMK->GetDictionary().GetKey( PdfName("RC") )->GetString();
+        return pMK->MustGetIndirectKey( PdfName("RC") )->GetString();
 
     return PdfString::StringNull;
 }
@@ -579,7 +579,7 @@
     PdfObject* pMK = this->GetAppearanceCharacteristics( false );
     
     if( pMK && pMK->GetDictionary().HasKey( PdfName("AC") ) )
-        return pMK->GetDictionary().GetKey( PdfName("AC") )->GetString();
+        return pMK->MustGetIndirectKey( PdfName("AC") )->GetString();
 
     return PdfString::StringNull;
 }
@@ -666,11 +666,11 @@
     if( !m_pObject->GetDictionary().HasKey( PdfName("AP") ) )
         m_pObject->GetDictionary().AddKey( PdfName("AP"), PdfDictionary() );
 
-    if( !m_pObject->GetDictionary().GetKey( PdfName("AP") )->GetDictionary().HasKey( PdfName("N") ) )
-        m_pObject->GetDictionary().GetKey( PdfName("AP") )->GetDictionary().AddKey( PdfName("N"), PdfDictionary() );
+    if( !m_pObject->MustGetIndirectKey( PdfName("AP") )->GetDictionary().HasKey( PdfName("N") ) )
+        m_pObject->MustGetIndirectKey( PdfName("AP") )->GetDictionary().AddKey( PdfName("N"), PdfDictionary() );
 
-    m_pObject->GetDictionary().GetKey( PdfName("AP") )->
-        GetDictionary().GetKey( PdfName("N") )->GetDictionary().AddKey( rName, rReference );
+    m_pObject->MustGetIndirectKey( PdfName("AP") )->
+        MustGetIndirectKey( PdfName("N") )->GetDictionary().AddKey( rName, rReference );
 }
 
 void PdfCheckBox::SetAppearanceChecked( const PdfXObject & rXObject )
@@ -691,13 +691,11 @@
 
 bool PdfCheckBox::IsChecked() const
 {
-    PdfDictionary dic = m_pObject->GetDictionary();
-
-    if (dic.HasKey(PdfName("V"))) {
-        PdfName name = dic.GetKey( PdfName("V") )->GetName();
+    if (m_pObject->GetDictionary().HasKey(PdfName("V"))) {
+        PdfName name = m_pObject->MustGetIndirectKey( PdfName("V") )->GetName();
         return (name == PdfName("Yes") || name == PdfName("On"));
-     } else if (dic.HasKey(PdfName("AS"))) {
-        PdfName name = dic.GetKey( PdfName("AS") )->GetName();
+     } else if (m_pObject->GetDictionary().HasKey(PdfName("AS"))) {
+        PdfName name = m_pObject->MustGetIndirectKey( PdfName("AS") )->GetName();
         return (name == PdfName("Yes") || name == PdfName("On"));
      }
 
@@ -763,7 +761,7 @@
     PdfString str;
 
     if( m_pObject->GetDictionary().HasKey( key ) )
-        str = m_pObject->GetDictionary().GetKey( key )->GetString();
+        str = m_pObject->MustGetIndirectKey( key )->GetString();
 
     return str;
 }
@@ -776,7 +774,7 @@
 pdf_long  PdfTextField::GetMaxLen() const
 {
     return static_cast<pdf_long>(m_pObject->GetDictionary().HasKey( PdfName("MaxLen") ) ? 
-                                 m_pObject->GetDictionary().GetKey( PdfName("MaxLen") )->GetNumber() : -1);
+                                 m_pObject->MustGetIndirectKey( PdfName("MaxLen") )->GetNumber() : -1);
 }
 
 /////////////////////////////////////////////////////////////////////////////
@@ -813,7 +811,6 @@
 void PdfListField::InsertItem( const PdfString & rsValue, const PdfString & rsDisplayName )
 {
     PdfVariant var;
-    PdfArray   opt;
 
     if( rsDisplayName == PdfString::StringNull ) 
         var = rsValue;
@@ -826,12 +823,13 @@
         var = array;
     }
 
-    if( m_pObject->GetDictionary().HasKey( PdfName("Opt") ) )
-        opt = m_pObject->GetDictionary().GetKey( PdfName("Opt") )->GetArray();
+    if( !m_pObject->GetDictionary().HasKey( PdfName("Opt") ) )
+        m_pObject->GetDictionary().AddKey( PdfName("Opt"), PdfArray() );
 
+    PdfArray &opt = m_pObject->MustGetIndirectKey( PdfName("Opt") )->GetArray();
+
     // TODO: Sorting
     opt.push_back( var );
-    m_pObject->GetDictionary().AddKey( PdfName("Opt"), opt );
 
     /*
     m_pObject->GetDictionary().AddKey( PdfName("V"), rsValue );
@@ -844,10 +842,10 @@
 
 void PdfListField::RemoveItem( int nIndex )
 {
-    PdfArray   opt;
+    if( !m_pObject->GetDictionary().HasKey( PdfName("Opt") ) )
+        m_pObject->GetDictionary().AddKey( PdfName("Opt"), PdfArray() );
 
-    if( m_pObject->GetDictionary().HasKey( PdfName("Opt") ) )
-        opt = m_pObject->GetDictionary().GetKey( PdfName("Opt") )->GetArray();
+    PdfArray &opt = m_pObject->MustGetIndirectKey( PdfName("Opt") )->GetArray();
     
     if( nIndex < 0 || nIndex > static_cast<int>(opt.size()) )
     {
@@ -855,7 +853,6 @@
     }
 
     opt.erase( opt.begin() + nIndex );
-    m_pObject->GetDictionary().AddKey( PdfName("Opt"), opt );
 }
 
 const PdfString PdfListField::GetItem( int nIndex ) const
@@ -863,7 +860,7 @@
     PdfArray   opt;
     
     if( m_pObject->GetDictionary().HasKey( PdfName("Opt") ) )
-        opt = m_pObject->GetDictionary().GetKey( PdfName("Opt") )->GetArray();
+        opt = m_pObject->MustGetIndirectKey( PdfName("Opt") )->GetArray();
     
     if( nIndex < 0 || nIndex > static_cast<int>(opt.size()) )
     {
@@ -889,7 +886,7 @@
     PdfArray   opt;
     
     if( m_pObject->GetDictionary().HasKey( PdfName("Opt") ) )
-        opt = m_pObject->GetDictionary().GetKey( PdfName("Opt") )->GetArray();
+        opt = m_pObject->MustGetIndirectKey( PdfName("Opt") )->GetArray();
     
     if( nIndex < 0 || nIndex >= static_cast<int>(opt.size()) )
     {
@@ -915,7 +912,7 @@
     PdfArray   opt;
     
     if( m_pObject->GetDictionary().HasKey( PdfName("Opt") ) )
-        opt = m_pObject->GetDictionary().GetKey( PdfName("Opt") )->GetArray();
+        opt = m_pObject->MustGetIndirectKey( PdfName("Opt") )->GetArray();
     
     return opt.size();
 }
@@ -931,7 +928,7 @@
 {
     if( m_pObject->GetDictionary().HasKey( PdfName("V") ) )
     {
-        PdfObject* pValue = m_pObject->GetDictionary().GetKey( PdfName("V") );
+        PdfObject* pValue = m_pObject->MustGetIndirectKey( PdfName("V") );
         if( pValue->IsString() || pValue->IsHexString() )
         {
             PdfString value = pValue->GetString();
Index: src/podofo/doc/PdfFileSpec.cpp
===================================================================
--- src/podofo/doc/PdfFileSpec.cpp	(revision 1999)
+++ src/podofo/doc/PdfFileSpec.cpp	(working copy)
@@ -335,12 +335,12 @@
 {
     if( canUnicode && this->GetObject()->GetDictionary().HasKey( "UF" ) )
 {
-        return this->GetObject()->GetDictionary().GetKey( "UF" )->GetString();
+        return this->GetObject()->MustGetIndirectKey( "UF" )->GetString();
     }
 
     if( this->GetObject()->GetDictionary().HasKey( "F" ) )
     {
-        return this->GetObject()->GetDictionary().GetKey( "F" )->GetString();
+        return this->GetObject()->MustGetIndirectKey( "F" )->GetString();
     }
 
     PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
Index: src/podofo/doc/PdfFontFactory.cpp
===================================================================
--- src/podofo/doc/PdfFontFactory.cpp	(revision 1999)
+++ src/podofo/doc/PdfFontFactory.cpp	(working copy)
@@ -192,7 +192,7 @@
     PdfObject*      pDescriptor = NULL;
     PdfObject*      pEncoding   = NULL;
 
-    PdfVariant* pTypeKey = pObject->GetDictionary().GetKey( PdfName::KeyType );
+    PdfVariant* pTypeKey = pObject->GetIndirectKey( PdfName::KeyType );
     if ( NULL == pTypeKey )
     {
         PODOFO_RAISE_ERROR_INFO( ePdfError_InvalidDataType, "Font: No Type" );
@@ -203,8 +203,7 @@
         PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
     }
 
-    PdfVariant* pSubTypeKey = pObject->GetDictionary()
-                            .GetKey( PdfName::KeySubtype );
+    PdfVariant* pSubTypeKey = pObject->GetIndirectKey( PdfName::KeySubtype );
     if ( NULL == pSubTypeKey )
     {
         PODOFO_RAISE_ERROR_INFO( ePdfError_InvalidDataType, "Font: No SubType" );
@@ -295,7 +294,7 @@
            // Its extremely complicated to interpret the type1 font programs
            // so i try to determine if its a symbolic font by reading the FontDescriptor Flags
            // Flags & 4 --> Symbolic, Flags & 32 --> Nonsymbolic
-            pdf_int32 lFlags = static_cast<pdf_int32>(pDescriptor->GetDictionary().GetKeyAsLong( "Flags", 0L ));
+            pdf_int32 lFlags = static_cast<pdf_int32>(pDescriptor->GetIndirectKeyAsLong( "Flags", 0L ));
             if ( lFlags & 32 ) // Nonsymbolic, otherwise pEncoding remains NULL
                 pPdfEncoding = PdfEncodingFactory::GlobalStandardEncodingInstance();
         }
Index: src/podofo/doc/PdfFontMetricsObject.cpp
===================================================================
--- src/podofo/doc/PdfFontMetricsObject.cpp	(revision 1999)
+++ src/podofo/doc/PdfFontMetricsObject.cpp	(working copy)
@@ -48,27 +48,27 @@
 {
     m_missingWidth = NULL;
 
-    const PdfName & rSubType = pFont->GetDictionary().GetKey( PdfName::KeySubtype )->GetName();
+    const PdfName & rSubType = pFont->MustGetIndirectKey( PdfName::KeySubtype )->GetName();
 
     // OC 15.08.2010 BugFix: /FirstChar /LastChar /Widths are in the Font dictionary and not in the FontDescriptor
 	if ( rSubType == PdfName("Type1") || rSubType == PdfName("Type3") || rSubType == PdfName("TrueType") ) {
         if ( pDescriptor ) {
             if (pDescriptor->GetDictionary().HasKey( "FontName" ))
-                m_sName        = pDescriptor->GetIndirectKey( "FontName" )->GetName();
+                m_sName        = pDescriptor->MustGetIndirectKey( "FontName" )->GetName();
             if (pDescriptor->GetDictionary().HasKey( "FontBBox" ))
-                m_bbox         = pDescriptor->GetIndirectKey( "FontBBox" )->GetArray();
+                m_bbox         = pDescriptor->MustGetIndirectKey( "FontBBox" )->GetArray();
         } else {
             if (pFont->GetDictionary().HasKey( "Name" ))
-                m_sName        = pFont->GetIndirectKey( "Name" )->GetName();
+                m_sName        = pFont->MustGetIndirectKey( "Name" )->GetName();
             if (pFont->GetDictionary().HasKey( "FontBBox" ))
-                m_bbox         = pFont->GetIndirectKey( "FontBBox" )->GetArray();
+                m_bbox         = pFont->MustGetIndirectKey( "FontBBox" )->GetArray();
         }
         if (pFont->GetDictionary().HasKey( "FontMatrix" )) {
             // Type3 fonts have a custom FontMatrix
-            m_matrix = pFont->GetIndirectKey( "FontMatrix" )->GetArray();
+            m_matrix = pFont->MustGetIndirectKey( "FontMatrix" )->GetArray();
         }
-		m_nFirst       = static_cast<int>(pFont->GetDictionary().GetKeyAsLong( "FirstChar", 0L ));
-        m_nLast        = static_cast<int>(pFont->GetDictionary().GetKeyAsLong( "LastChar", 0L ));
+        m_nFirst       = static_cast<int>(pFont->GetIndirectKeyAsLong( "FirstChar", 0L ));
+        m_nLast        = static_cast<int>(pFont->GetIndirectKeyAsLong( "LastChar", 0L ));
         // OC 15.08.2010 BugFix: GetIndirectKey() instead of GetDictionary().GetKey() and "Widths" instead of "Width"
         PdfObject* widths = pFont->GetIndirectKey( "Widths" );
         
@@ -80,9 +80,9 @@
         else
         {
             if ( pDescriptor ) {
-                widths = pDescriptor->GetDictionary().GetKey( "MissingWidth" );
+                widths = pDescriptor->GetIndirectKey( "MissingWidth" );
             } else {
-                widths = pFont->GetDictionary().GetKey( "MissingWidth" );
+                widths = pFont->GetIndirectKey( "MissingWidth" );
             }
             if( widths == NULL ) 
             {
@@ -102,7 +102,7 @@
 		m_nFirst = 0;
 		m_nLast = 0;
 
-		m_dDefWidth = static_cast<double>(pFont->GetDictionary().GetKeyAsLong( "DW", 1000L ));
+        m_dDefWidth = static_cast<double>(pFont->GetIndirectKeyAsLong( "DW", 1000L ));
 		PdfVariant default_width(m_dDefWidth);
 		PdfObject * pw = pFont->GetIndirectKey( "W" );
 
@@ -153,10 +153,10 @@
 	}
     
     if ( pDescriptor ) {
-        m_nWeight      = static_cast<unsigned int>(pDescriptor->GetDictionary().GetKeyAsLong( "FontWeight", 400L ));
-        m_nItalicAngle = static_cast<int>(pDescriptor->GetDictionary().GetKeyAsLong( "ItalicAngle", 0L ));
-        m_dPdfAscent   = pDescriptor->GetDictionary().GetKeyAsReal( "Ascent", 0.0 );
-        m_dPdfDescent  = pDescriptor->GetDictionary().GetKeyAsReal( "Descent", 0.0 );
+        m_nWeight      = static_cast<unsigned int>(pDescriptor->GetIndirectKeyAsLong( "FontWeight", 400L ));
+        m_nItalicAngle = static_cast<int>(pDescriptor->GetIndirectKeyAsLong( "ItalicAngle", 0L ));
+        m_dPdfAscent   = pDescriptor->GetIndirectKeyAsReal( "Ascent", 0.0 );
+        m_dPdfDescent  = pDescriptor->GetIndirectKeyAsReal( "Descent", 0.0 );
     } else {
         m_nWeight      = 400L;
         m_nItalicAngle = 0L;
Index: src/podofo/doc/PdfImage.cpp
===================================================================
--- src/podofo/doc/PdfImage.cpp	(revision 1999)
+++ src/podofo/doc/PdfImage.cpp	(working copy)
@@ -81,8 +81,8 @@
 PdfImage::PdfImage( PdfObject* pObject )
     : PdfXObject( "Image", pObject )
 {
-    m_rRect.SetHeight( static_cast<double>(this->GetObject()->GetDictionary().GetKey( "Height" )->GetNumber()) );
-    m_rRect.SetWidth ( static_cast<double>(this->GetObject()->GetDictionary().GetKey( "Width" )->GetNumber()) );
+    m_rRect.SetHeight( static_cast<double>(this->GetObject()->MustGetIndirectKey( "Height" )->GetNumber()) );
+    m_rRect.SetWidth ( static_cast<double>(this->GetObject()->MustGetIndirectKey( "Width" )->GetNumber()) );
 }
 
 PdfImage::~PdfImage()
Index: src/podofo/doc/PdfInfo.cpp
===================================================================
--- src/podofo/doc/PdfInfo.cpp	(revision 1999)
+++ src/podofo/doc/PdfInfo.cpp	(working copy)
@@ -84,7 +84,7 @@
 
 const PdfString & PdfInfo::GetStringFromInfoDict( const PdfName & rName ) const
 {
-    const PdfObject* pObj = this->GetObject()->GetDictionary().GetKey( rName );
+    const PdfObject* pObj = this->GetObject()->GetIndirectKey( rName );
     
     return pObj && (pObj->IsString() || pObj->IsHexString()) ? pObj->GetString() : PdfString::StringNull;
 }
@@ -91,7 +91,7 @@
 
 const PdfName & PdfInfo::GetNameFromInfoDict(const PdfName & rName) const
 {
-	const PdfObject* pObj = this->GetObject()->GetDictionary().GetKey( rName );
+    const PdfObject* pObj = this->GetObject()->GetIndirectKey( rName );
     
 	return pObj && pObj->IsName() ? pObj->GetName() : PdfName::KeyNull;
 }
Index: src/podofo/doc/PdfNamesTree.cpp
===================================================================
--- src/podofo/doc/PdfNamesTree.cpp	(revision 1999)
+++ src/podofo/doc/PdfNamesTree.cpp	(working copy)
@@ -78,7 +78,7 @@
 {
     if( m_bHasKids )
     {
-        const PdfArray &         kids   = this->GetObject()->GetDictionary().GetKey("Kids")->GetArray();
+        const PdfArray &         kids   = this->GetObject()->MustGetIndirectKey("Kids")->GetArray();
         PdfArray::const_iterator it     = kids.begin();
         PdfObject*               pChild = NULL;
         EPdfNameLimits           eLimits = ePdfNameLimits_Before; // RG: TODO Compiler complains that this variable should be initialised
@@ -135,7 +135,7 @@
 
         if( this->GetObject()->GetDictionary().HasKey( "Names" ) ) 
         {
-            PdfArray& array = this->GetObject()->GetDictionary().GetKey("Names")->GetArray();
+            PdfArray& array = this->GetObject()->MustGetIndirectKey("Names")->GetArray();
             PdfArray::iterator it = array.begin();
             
             while( it != array.end() )
@@ -208,19 +208,19 @@
     if( m_bHasKids ) 
     {
         if( this->GetObject()->GetDictionary().HasKey( PdfName("Kids") ) &&
-            this->GetObject()->GetDictionary().GetKey( PdfName("Kids") )->IsArray() )
+            this->GetObject()->MustGetIndirectKey( PdfName("Kids") )->IsArray() )
         {
-            const PdfReference & rRefFirst = (*this->GetObject()->GetDictionary().GetKey("Kids")->GetArray().begin()).GetReference();
+            const PdfReference & rRefFirst = (*this->GetObject()->MustGetIndirectKey("Kids")->GetArray().begin()).GetReference();
             PdfObject* pChild = this->GetObject()->GetOwner()->GetObject( rRefFirst );
             if( pChild && pChild->GetDictionary().HasKey( PdfName("Limits") ) &&
-                pChild->GetDictionary().GetKey( PdfName("Limits") )->IsArray() ) 
-                limits.push_back( *(pChild->GetDictionary().GetKey("Limits")->GetArray().begin()) );
+                pChild->MustGetIndirectKey( PdfName("Limits") )->IsArray() ) 
+                limits.push_back( *(pChild->MustGetIndirectKey("Limits")->GetArray().begin()) );
             
-            const PdfReference & rRefLast = this->GetObject()->GetDictionary().GetKey("Kids")->GetArray().back().GetReference();
+            const PdfReference & rRefLast = this->GetObject()->MustGetIndirectKey("Kids")->GetArray().back().GetReference();
             pChild = this->GetObject()->GetOwner()->GetObject( rRefLast );
             if( pChild && pChild->GetDictionary().HasKey( PdfName("Limits") ) &&
-                pChild->GetDictionary().GetKey( PdfName("Limits") )->IsArray() ) 
-                limits.push_back( pChild->GetDictionary().GetKey("Limits")->GetArray().back() );
+                pChild->MustGetIndirectKey( PdfName("Limits") )->IsArray() ) 
+                limits.push_back( pChild->MustGetIndirectKey("Limits")->GetArray().back() );
         }
         else
             PdfError::LogMessage( eLogSeverity_Error, 
@@ -231,10 +231,10 @@
     else // has "Names"
     {
         if( this->GetObject()->GetDictionary().HasKey( PdfName("Names") ) &&
-            this->GetObject()->GetDictionary().GetKey( PdfName("Names") )->IsArray() )
+            this->GetObject()->MustGetIndirectKey( PdfName("Names") )->IsArray() )
         {
-            limits.push_back( (*this->GetObject()->GetDictionary().GetKey("Names")->GetArray().begin()) );
-            limits.push_back( (*(this->GetObject()->GetDictionary().GetKey("Names")->GetArray().end()-2)) );
+            limits.push_back( (*this->GetObject()->MustGetIndirectKey("Names")->GetArray().begin()) );
+            limits.push_back( (*(this->GetObject()->MustGetIndirectKey("Names")->GetArray().end()-2)) );
         }
         else
             PdfError::LogMessage( eLogSeverity_Error, 
@@ -252,8 +252,8 @@
 
 bool PdfNameTreeNode::Rebalance()
 {
-    PdfArray* pArray            = m_bHasKids ? &(this->GetObject()->GetDictionary().GetKey("Kids")->GetArray()) :
-                                               &(this->GetObject()->GetDictionary().GetKey("Names")->GetArray());
+    PdfArray* pArray            = m_bHasKids ? &(this->GetObject()->MustGetIndirectKey("Kids")->GetArray()) :
+                                               &(this->GetObject()->MustGetIndirectKey("Names")->GetArray());
     const PdfName& key          = m_bHasKids ? PdfName("Kids") : PdfName("Names");
     const unsigned int nLength  = m_bHasKids ? BALANCE_TREE_MAX : BALANCE_TREE_MAX * 2;
 
@@ -281,7 +281,7 @@
         else
         {
             pChild1 = this->GetObject();
-            kids    = m_pParent->GetObject()->GetDictionary().GetKey("Kids")->GetArray();
+            kids    = m_pParent->GetObject()->MustGetIndirectKey("Kids")->GetArray();
         }
 
         pChild1->GetDictionary().AddKey( key, first );
@@ -377,7 +377,7 @@
 
     if( pObj->GetDictionary().HasKey("Kids") )
     {
-        const PdfArray & kids       = pObj->GetDictionary().GetKey("Kids")->GetArray();
+        const PdfArray & kids       = pObj->MustGetIndirectKey("Kids")->GetArray();
         PdfArray::const_iterator it = kids.begin();
 
         while( it != kids.end() )
@@ -401,7 +401,7 @@
     }
     else
     {
-        PdfArray & names      = pObj->GetDictionary().GetKey("Names")->GetArray();
+        PdfArray & names      = pObj->MustGetIndirectKey("Names")->GetArray();
         PdfArray::iterator it = names.begin();
 
         // a names array is a set of PdfString/PdfObject pairs
@@ -446,7 +446,7 @@
 {
     if( pObj->GetDictionary().HasKey("Limits") ) 
     {
-        const PdfArray & limits = pObj->GetDictionary().GetKey("Limits")->GetArray();
+        const PdfArray & limits = pObj->MustGetIndirectKey("Limits")->GetArray();
 
         if( limits[0].GetString() > key )
             return ePdfNameLimits_Before;
@@ -476,7 +476,7 @@
 {
     if( pObj->GetDictionary().HasKey("Kids") )
     {
-        const PdfArray & kids       = pObj->GetDictionary().GetKey("Kids")->GetArray();
+        const PdfArray & kids       = pObj->MustGetIndirectKey("Kids")->GetArray();
         PdfArray::const_iterator it = kids.begin();
 
         while( it != kids.end() )
@@ -494,7 +494,7 @@
     }
     else if( pObj->GetDictionary().HasKey("Names") )
     {
-        const PdfArray & names      = pObj->GetDictionary().GetKey("Names")->GetArray();
+        const PdfArray & names      = pObj->MustGetIndirectKey("Names")->GetArray();
         PdfArray::const_iterator it = names.begin();
 
         // a names array is a set of PdfString/PdfObject pairs
Index: src/podofo/doc/PdfPage.cpp
===================================================================
--- src/podofo/doc/PdfPage.cpp	(revision 1999)
+++ src/podofo/doc/PdfPage.cpp	(working copy)
@@ -225,7 +225,7 @@
     // check for it in the object itself
     if ( inObject->GetDictionary().HasKey( inKey ) ) 
     {
-        pObj = inObject->GetDictionary().GetKey( inKey );
+        pObj = inObject->MustGetIndirectKey( inKey );
         if ( !pObj->IsNull() ) 
             return pObj;
     }
@@ -269,13 +269,6 @@
     // Take advantage of inherited values - walking up the tree if necessary
     pObj = GetInheritedKeyFromObject( inBox, this->GetObject() );
     
-
-    // Sometime page boxes are defined using reference objects
-    while ( pObj && pObj->IsReference() )
-    {
-        pObj = this->GetObject()->GetOwner()->GetObject( pObj->GetReference() );
-    }
-
     // assign the value of the box from the array
     if ( pObj && pObj->IsArray() )
     {
@@ -611,8 +604,8 @@
                     PODOFO_RAISE_ERROR_INFO( ePdfError_NoObject, oss.str() );
                 }
 
-                if( pNode->GetDictionary().GetKey( PdfName::KeyType ) != NULL 
-                    && pNode->GetDictionary().GetKey( PdfName::KeyType )->GetName() == PdfName( "Pages" ) )
+                if( pNode->GetDictionary().HasKey( PdfName::KeyType )
+                    && pNode->MustGetIndirectKey( PdfName::KeyType )->GetName() == PdfName( "Pages" ) )
                 {
                     PdfObject* pCount = pNode->GetIndirectKey( "Count" );
                     if( pCount != NULL ) {
Index: src/podofo/doc/PdfPagesTree.cpp
===================================================================
--- src/podofo/doc/PdfPagesTree.cpp	(revision 1999)
+++ src/podofo/doc/PdfPagesTree.cpp	(working copy)
@@ -440,7 +440,7 @@
     if( !pObject )
         return false;
 
-    if( pObject->GetDictionary().GetKeyAsName( PdfName( "Type" ) ) == PdfName( "Page" ) )
+    if( pObject->GetIndirectKeyAsName( PdfName( "Type" ) ) == PdfName( "Page" ) )
         return true;
 
     return false;
@@ -451,7 +451,7 @@
     if( !pObject )
         return false;
 
-    if( pObject->GetDictionary().GetKeyAsName( PdfName( "Type" ) ) == PdfName( "Pages" ) )
+    if( pObject->GetIndirectKeyAsName( PdfName( "Type" ) ) == PdfName( "Pages" ) )
         return true;
 
     return false;
@@ -479,7 +479,7 @@
         return -1;
     }
 
-    const PdfArray & rKids = pPageParent->GetDictionary().GetKey( PdfName("Kids") )->GetArray();
+    const PdfArray & rKids = pPageParent->MustGetIndirectKey( PdfName("Kids") )->GetArray();
     PdfArray::const_iterator it = rKids.begin();
 
     int index = 0;
@@ -513,7 +513,7 @@
     // 3. Add Parent key to the page
 
     // 1. Add reference
-    const PdfArray oldKids = pParent->GetDictionary().GetKey( PdfName("Kids") )->GetArray();
+    const PdfArray oldKids = pParent->MustGetIndirectKey( PdfName("Kids") )->GetArray();
     PdfArray::const_iterator it = oldKids.begin();
     PdfArray newKids;
 
@@ -571,7 +571,7 @@
     // 3. Add Parent key to the page
 
     // 1. Add reference
-    const PdfArray oldKids = pParent->GetDictionary().GetKey( PdfName("Kids") )->GetArray();
+    const PdfArray oldKids = pParent->MustGetIndirectKey( PdfName("Kids") )->GetArray();
     PdfArray newKids;
     newKids.reserve( oldKids.GetSize() + vecPages.size() );
 
@@ -663,7 +663,7 @@
 
 void PdfPagesTree::DeletePageNode( PdfObject* pParent, int nIndex ) 
 {
-    PdfArray kids = pParent->GetDictionary().GetKey( PdfName("Kids") )->GetArray();
+    PdfArray kids = pParent->MustGetIndirectKey( PdfName("Kids") )->GetArray();
     kids.erase( kids.begin() + nIndex );
     pParent->GetDictionary().AddKey( PdfName("Kids"), kids );
 }
@@ -689,7 +689,7 @@
 
     if( pPageNode->GetDictionary().HasKey( PdfName("Kids") ) )
     {
-        bKidsEmpty = pPageNode->GetDictionary().GetKey( PdfName("Kids") )->GetArray().empty();
+        bKidsEmpty = pPageNode->MustGetIndirectKey( PdfName("Kids") )->GetArray().empty();
     }
 
     return ( lCount == 0L || bKidsEmpty );
Index: src/podofo/doc/PdfPainter.cpp
===================================================================
--- src/podofo/doc/PdfPainter.cpp	(revision 1999)
+++ src/podofo/doc/PdfPainter.cpp	(working copy)
@@ -1246,7 +1246,7 @@
 			PODOFO_ASSERT( pEncoding != NULL ); // paranoia
 
 			PdfArray diffs;
-			diffs = pEncoding->GetDictionary().GetKey( "Differences" )->GetArray();
+            diffs = pEncoding->MustGetIndirectKey( "Differences" )->GetArray();
 
 			bool foundIt = false;
 
@@ -1284,13 +1284,13 @@
 			code++;
 
 			PdfArray diffs;
-			diffs = pEncoding->GetDictionary().GetKey( "Differences" )->GetArray();
+            diffs = pEncoding->MustGetIndirectKey( "Differences" )->GetArray();
 			diffs.push_back( PdfName( pszGlyphname ) );
 
 			pEncoding->GetDictionary().AddKey( "Differences", diffs );
 
 			// enter width of glyph
-			PdfObject* pWidthObj = pGlyphFontObj->GetIndirectKey( "Widths" );
+            PdfObject* pWidthObj = pGlyphFontObj->MustGetIndirectKey( "Widths" );
 			PdfArray & rWidthArr = pWidthObj->GetArray();
 			rWidthArr[code] = PdfVariant( static_cast<pdf_int64>( width ) );
 
Index: src/podofo/doc/PdfSignatureField.cpp
===================================================================
--- src/podofo/doc/PdfSignatureField.cpp	(revision 1999)
+++ src/podofo/doc/PdfSignatureField.cpp	(working copy)
@@ -65,7 +65,7 @@
     // do not call Init() here
     if( this->GetFieldObject()->GetDictionary().HasKey( "V" ) )
     {
-        m_pSignatureObj = this->GetFieldObject()->GetOwner()->GetObject( this->GetFieldObject()->GetDictionary().GetKey( "V" )->GetReference() );
+        m_pSignatureObj = GetFieldObject()->GetIndirectKey( "V" );
     }
 }
 
Index: src/podofo/doc/PdfXObject.cpp
===================================================================
--- src/podofo/doc/PdfXObject.cpp	(revision 1999)
+++ src/podofo/doc/PdfXObject.cpp	(working copy)
@@ -347,7 +347,7 @@
     ostringstream out;
     PdfLocaleImbue(out);
 
-    if( this->GetObject()->GetDictionary().GetKeyAsName( PdfName::KeySubtype ) != pszSubType ) 
+    if( this->GetObject()->GetIndirectKeyAsName( PdfName::KeySubtype ) != pszSubType ) 
     {
         PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
     }
