Fixed leaks
Fixed freeing lists