some porting fixes