Fixed some memory leak.