adjusted to always check for table