Porting fixes