Fix some bug and relink Makefile