Fixed Solution Writing Logic

There was values errors on the solution wrote into the file. They are
fixed now.