Fix bug while resetting THD variables