fixed memory leak in demo