Change writeRegister and readRegister