Fix api request handler