Various changes to make the test programs compile and run on Linux (tested on Debian)