better detection of invitation code