analytics tracking, some bug fixes