adapt to #3394 backport