Changes to compile with FPC/Linux

FPC/Linux code is still completely untested!!!