Various minor fixes
Various minor fixes in preparation for further refactoring of the threads. They’re not particularly related to each other; just some things I spotted while working on these areas of code.
See the commit messages for details.
Edited by Philip Withnall