fix join function