FIXED: all compiler warnings, plus a couple of minor build errors from Apple bugs