fixed compilation errors on Mac OS X