Corrected some synchronization bugs.