XD-1919:add test and some other code change