[API] fix invalid variable reference in Legacy API