Add some debug logging to diagnose problems