fix some small bugs for API