fix OS X compile errors and warnings