Repair join table bug and implement connection timeout