porting fixes