Changing makefile, fixing bugs in build