fixed initialization with empty document