Various fixes to RunTask.py and restrint.py socket exception errors