fixed crash, added debug mode in Makefile