fix some bugs, include schema in foreign table definition