Fix join bug