improve find and replace slightly; add coverage of pkg scripts; add a check afterward