fixed memory corruption on remove, not sure if I have a memory leak now.