Fix build issues in macos mavericks