fixing a bug with clearInvites