NOJIRA: Fix CollectionStats crash bug

The CollectionStats webapp was crashing because "d was null". This fix
moves the offending code into an addenda that was previously only used
by collectionstats, nicely solving the problem (knock on wood).