set handler in merge function