Fixed test and build erros on Mac OS X