Fixed valgrind issues (Pierre, malloc memory is uninitialized -> lots of code was using flags that were in random state.. and there was some debugging using structs that were freed first)