added a null check for table cells