Add a default implementation for replace().