Fixed two bugs in formula handling:

(1) A typo
(2) Need to remove I() when using "with"
(3) When replacing I(), keep ()