Fixed a big memory leak + wrong delete type