bug fixes wrt null CurrentDocument