Fix memory leaks
Fix list_append usage
Fix/add some assertions
Add list_fork; test it