Fixed bug in attachment manager