* Fix #22054 * Replace #34593, #27800 * And refactor legacy code, fix various problems --------- Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>