Fix some race conditions by passing lockable objects by reference. Make output of run update in real time.