Fixing delete attachment condition.