This is just a quick and dirty change to make this mod work with Factorio 1.1, original is by PyroFire here:
https://mods.factorio.com/mod/beltcounter
Hopefully as soon as that mod works with the latest version of the game, this mod can be deprecated/removed.