* Fix problems in #1819 * Add test cases --------- Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>