Fixed Bugs in the API Controllers