Added debug checks.