thread synchronization bug repaired