Fixing memleak