bug fixed about mem leaks