fix minor bug in function add_image_links