Cherrypicked in abfab e3040 6f939 5a50cc from test-rundat branch