fixed deallocations and replaced the usage of NULL with C++0x nullptr