I'm not really sure what the problem is. It might be that you're on 5.0.2, and the code was original written for 4.6.3
Perhaps the behavior of ad_form has changed somehow? I'm not certain.
I'm on IRC during most of the day. Perhaps we can walk through it?