Fix scanRecord & writeRecord