Various fixes to distribute to branches. WIP.