changed bug that enddate was not set correctly