improved email invitation logics