Fixed some minor bugs due to date ordering.