solving synchronization problem