changed output_solutions.cpp so that memory free is in line with allocated memory