add optimization in callout replacement