fix infinite loop problem with sharing of images