Better fix for multi-dim array case