fixed bug in api_controller