Fix table relation bug