fix replacement error reporting