Fixed logic issue that caused attachment tests to fail with this fix