fix call legalization bug