bad date math was causing errors