Some memory leak corrected.