changes for supporting mac os following commit e11d770e2b897e40caa94d0dc6c693f0785bc41b