Wip 5992 2

First 3 patches are 5869, only here because I ran it all through the nightlies at the same time.
Rest are for 5992 (and associated bug)