Fixed bugs on Mac OS X