fix #27 by only counting latest agent versions

The detected latest scanning agent ids are used as condition for the histogram query.