fix some errors and add test makefile