Fix bug in presence detection (from prev change)