Fix bug related to multiple tables