fixed memory leak by putting script in a subprocess