Fixed a problem with joins at large scale