fix a nasty bug with multiline replace, add insert and replace at markers