Fix up some bugs after fixing makefile