fixed some threading issues in adhoc.py