Fixed a race condition in drive control