added api error support