Fix bug in time-integration