Dynamic 2d  Array malfunction