Compile under OS X

Project files and small code fixes.