Port over fixes from branch next