fixed the last date bug