removing  memory leaks