fix order of update and dt