move decalare postion
fix potential mem leak
fix use mem after free
fix wrong global layout. the better way is merge the lists
misc