tweaked replace so that occurences within strings are not altered; fixed prs error