fix reg bug