fixed: error stream can be null in some cases.