added specs, some fixes for join_tables