bug fix to api