modify codes according http://wenku.baidu.com/view/e993e17601f69e314332949e.html