update mergesame.py for simple and clean