fixed bug in handle invitation