fix last join being skipped