[Fix] Some bugs in Optimization

It fixed bugs in tracing optimization and (maybe) solved freezing in
linesearch caused by overloaded parallelization.