Fixed some bugs in exact algorithm
Added #define for DEBUG messages in exact algorithm