Compilation/porting fixes

The last update port seems to have broken some stuff.