Some nine fixes
Basically a few fixes for gallium nine, mostly unrelated to each other.
Some of these patches do not have the same quality testing as my usual patch series. For example, I would have usually taken the time to write and run some tests on windows to confirm the behaviour some of them implement, but this takes a lot of time, and I'd better have these patches in, as they do fix issues.