Fix parsing loaded document