fixes and other optimization for table directive