fixed api error handling, like missing json params.