Fix bug & 2 warnings on OS X