fixed a mismatced new[] with a delete[]