Refactroed self presence checks, handle null stanzas

Issue #341