Fix for incorrect date() check