modify to mattn's code
update merge