Fix freezing when attaching image.