Add options for configuring default root, fix global replace bug