cherry pick changes from the engine-new-test branch