Fixed attachment id retrieval.