fix possible memleak