Integrate missing patches from C. Garbs