bug fix in api_controller