rewrite args of scan and reduce