check tables function