add check for dangling documents