fixes #267: Total day count can be wrong (because of not sorting)