fix broken references and improve synchronization