Improved platform support on Makefile (issue #12) and fixed a couple of memory leaks