critical bug in solve is fixed
remove unnecessary loop