more document opening fixes