Fix possible NPE for script like /test.py