add value replacement support to chain()