- 
    Type:
Bug
 - 
    Resolution: Done
 - 
    Priority:
Minor - P4
 - 
    None
 - 
    Affects Version/s: None
 - 
    Component/s: Wire Protocol
 - 
    None
 
- 
        None
 
- 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 
The main document isn't always in the first document. For instance, running delete in the shell puts the main document (seemingly) last. I think we just need to loop until you find a type 0 section and use that.