fixed all mem leaks