fixed mem leaks;