fix TypeError in API