fixed bugs on changing dates