fix undeclared variable
fix corrupted table