fix bug for generate api