Only add message dependency when necessary.