move error output to script