API implementation: fixed some errors