Fixed a bug with final date handling