fix reg configuration code