Fix a potential bug in d-presence