fix join function bug