fixed a bug with upper limit for dates