Added debug mode for finding connection leaks