fixing code when sending invitation -ref #3702