find and replace module

fix wrong logic