Added currDoc null check