Fixed Makefile and some changes in the script