Fix parentheses position

Fix parentheses to work in gettables mode with normal tables and foreign tables.