delete instructions have been replaced to delete[] where needed