fixes the api and update the db