fix bug in binarymerge, fix #12, fix #13