improve dynamic arrays (should never crash now)