Various fixes.

Various fixes including one for the most worse issue that hangs up totally some linux distributions.