changes to the API and bug fixes