Minor fixes to analytics.py