Fix JS bug on handling deleted attachments.