change cast/casts reference handling model to avoid copying for identity cast on table terminal