analytics and some bug fixes