Fix the bug of pressing cancel button in invitation dialog