fix a small bug in models files, and adjust the api code