Fixed attachment delete code