fixed python spooler memory leak
simplified the python spooler code