Fix image deletion problem