fix bugs in Makefiles and test.sh
working commit