fix bugs in merge_imgs.php