fixing bug #5036
checking places of image before deleting it...