Fixed r.literal in update.
fixed replace regression
added tests