Fixed null doc bug