writeRegId method added