fix chainer function