Fixing mismatched new/delete