Fix attachments maintenance - tanks AaronB for the report

Signed-off-by: emanuele <emanuele45@gmail.com>