fix some bug in connector and writer