Fix possible race condition in undelete and remove.
Clean up newsgroups.js a bit more.