fix an invalid read error