fix bug for partial written