#3868: Fix bugs with removing and adding new image again.