export $debug so that it is seen by subprocess