make sed() support replacement function, fixes #115