fix bug for API