wrap 'chain' function because it modifies its arguments