Update script.py

Fix some remaining threading issues.