Modifying makefiles, fixed some bugs in utils.c