Write all Preferences to xml
Some changes for running under MacOSX, Windows and Linux-x86