Patched some memleaks