Fix bug which causes timeperiods not to be updated.