* fix a bug in the join generator * add another test case to make sure the outer table foreach still works when removing an item * throw exception if table cannot be joined automatically