more porting
finish porting code