Fix date comparison; add extra logging