Are you using the extended flag script found here:
http://www.pokecommunity.com/showthread.php?t=302476
Which ROM are you using? Firered has the most support available so it is easiest for hacking.
If you do NOT wish to extend the flags, you could also add one of the flags you already set to the person ID.
For instance, since he is giving you the Pokemon, and I see that you are already setting flag 0x828, you could make the person ID $0828 for the professor.
Let me know what happens, and thanks for getting in touch!
EDIT: LOL, I just saw your most recent activity pointing to the thread I posted. A note: JPANS patch is at the last page, so download that and patch it.