Fix possible memleak