some porting work