Fixed several table related issues