rewrite error code, fix streamreader