Correctly convert dates in statistics. Fixes #264