Fixed nullpointer bug when row and col are maxed