[backport] Backports #358, #360, #353