Fix exceptions on DTE.ActiveDocument

Close #653.
Merge pull request #654 from dungpa/active-doc-exception

Fix exceptions on DTE.ActiveDocument