fix response statuses, return json with error instead of http error codes