modify from wangxf