Makefile and bugfixes