fixed bug where replacing attachment would unnecessarily create a new attachment object