ex-37 (kmeng/jebene): fixed bug in merge.py - need to make tests pass
and add new tests