fix --search/--replace when used with CLI