fixed dependancies added error handling in the API

fixed dependancies added error handling in the API