fixed memory leak in runtime