fix memory leak / fix settings Makefile