Reduce deadlock fix, memory leak fix
problem scaling, gcc flags