better implementation for analytics, fix #92