Sync with upstream and some small fixes. Updating iOS and Mac projects.