Fixed the segment fault error.
Added debug flag to the Makefile.