Fixed deallocation bug with targets