Fix bug in the API