wrong delete in dynarray, should be delete[]