Fix replace errors