rectified silly mistake in comparing dates