bug fixes to join method

the join method was modified to deal with more complicated
schemas--testing needed before merging with master.