Fix up some annoying deadlock issues.