[BUG] in fast compile related to inplace opt.

Also fix tests crash in fast_compile