corrected critical section order when deleting scripts
removed test debug output