Fixed bug in attachment acounter