improve again the merging script