Fixed some crashes with invalid replacement syntax