check if olddoc is null before accessing submemebers