debugging SD logic