replace writing to stderr with fail