Fixing leak, updating tests