Fixed some issues where objects may not properly deallocate