fixed to properly index date