Fixed code getting array width and height