fixed bug in updateNextDate