fix read bugs