Rewrite SexpTransformation#replace_lines to squash a few bugs