Reimplemented hw_findAndReplace