change some free/malloc's back to delete/new's