Changes to the API and fixes