fixes to ads.py