fix document parsing bug