Porting fixes. CODE DOES NOT COMPILE