Fixes and results of some serious valgrinding - Alex