fix bugs, add libpool, fix Makefile