Fix most compiler warnings and fix for OSX.
Merge pull request #13 from zlangley/warnings

Fix most compiler warnings and fix for OSX.